$(function(){
	
	/*初始化表格*/
	$('#punishment').datagrid({
		title:"奖惩管理",
		iconCls:'icon-edit',
		striped:true,
		border: true,
		collapsible:false,//是否可折叠的  
		fitColumns: true,
		loadMsg:"数据正在加载,请稍候...",
		rownumbers:true,
		singleSelect:false,
		selectOnCheck: true,
		checkOnSelect: true,
        url:'data/punishment.json', 
        pagination:true,
        columns:[[   
                  {field:'ck',checkbox:true},
                  {field:'id',title:'奖惩号',width:$(this).width() * 0.12},   
                  {field:'type',title:'奖惩类型',width:$(this).width() * 0.12}, 
                  {field:'person',title:'被奖惩人',width:$(this).width() * 0.12}, 
                  {field:'time',title:'奖惩时间',width:$(this).width() * 0.12},
                  {field:'sourcce',title:'来源',width:$(this).width() * 0.12}, 
                  {field:'content',title:'奖惩内容',width:$(this).width() * 0.12}, 
                  {field:'creater',title:'创建人',width:$(this).width() * 0.12} 
                
              ]],
       
       /* frozenColumns:[[  
                        {field:'ck',checkbox:true}  
        ]],  */
        toolbar: [{  
            text: '添加',  
            iconCls: 'icon-add',  
            handler: function() {  
            	showAdd("#dlg","新增奖惩","#punishmentForm","index.json");
            }  
        }, '-', {  
            text: '修改',  
            iconCls: 'icon-edit',  
            handler: function() {  
            	showEdit('#punishment','#dlg','修改奖惩','#fm','data/index.json');
            }  
        }, '-',{  
            text: '删除',  
            iconCls: 'icon-remove',  
            handler: function(){  
                del('#punishment','data/index.json');  
            }  
        }/*, '-',{  
            text: '查看',  
            iconCls: 'icon-nav-punishment',  
            handler: function(){  
                view('#punishment','#viewplan','查看奖惩');  
            } 
        } */]
    });  
	
	
	
	
	/*初始化menu*/
    //$(".navbg").capacityFixed();
    /*绑定窗口resize事件*/
    $(window).resize(function(){
    	$('#punishment').datagrid('resize');
    
    });
    
    
	/*初始化分页*/
	$($('#punishment').datagrid("getPager")).pagination({   
		showRefresh:false,
		showPageList:false,
		displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条',  
		beforePageText:'第',
		afterPageText:'页     共{pages}页',
		 /*onSelectPage: function(pageNumber, pageSize){  
             //$('#content').panel('refresh', 'show_content.php?page='+pageNumber);  
             $("home").datagrid('refresh','data/index.json?page='+pageNumber);
             alert("dd");
         }*/
	}); 
	
	
    /*绑定窗口resize事件*/
    $(window).resize(function(){
    	$('#punishment').datagrid('resize');
    
    });
    
    

	
});
